package com.jiuqi.nvwa.topicnavigator.adapter.topicnavfactory.impl;

import com.jiuqi.nvwa.topicnavigator.adapter.topicnavfactory.*;
import com.jiuqi.nvwa.topicnavigator.adapter.widget.entity.RadioData;
import com.jiuqi.nvwa.topicnavigator.adapter.widget.items.*;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;


/**
 * 类型：幻灯片主题导航
 */
@TopicNavFactoryResource(
        type = "topicnav_slide",
        title = "幻灯片",
        icon = "iconfont icon-J_DH_A_DATAV_huandengpian",
        displayPicture = "output/@nvwa/nvwa-topicnavigator-frontend/dist/static/slideType.png",
        allowNodeLevel=1,
        supportHighlightPic = true,
        supportFontIcon = false,
        allowLinkTopicNav = true
)
@Component
public class SlideTopicNavFactory implements ITopicNavFactory {

    @Override
    public List<TopicNavPropertyGroup> getTopicNavigatorProperty() {
        List<TopicNavPropertyGroup> topicNavPropertyGroupList = new ArrayList<>();
        topicNavPropertyGroupList.add(buildBaseGroup("基本信息"));
        return topicNavPropertyGroupList;
    }

    @Override
    public ITopicNavTransformer getTopicNavTransformer() {
        return null;
    }

    private TopicNavPropertyGroup buildBaseGroup(String baseGroupTitle) {

        TopicNavPropertyGroup topicNavPropertyGroup = new TopicNavPropertyGroup(baseGroupTitle);

        SlideBaseAttributeComboItem slideBaseAttributeProp = new SlideBaseAttributeComboItem("【自定义】属性组件");

        slideBaseAttributeProp.setSlideItemWidth("200");

        slideBaseAttributeProp.setSlideItemHeight("200");

        slideBaseAttributeProp.setSwitchType("1");

        List<RadioData> optionalSwitchTypeList = new ArrayList<>(2);
        RadioData switchTypeRadio1 = new RadioData("0","手动");
        optionalSwitchTypeList.add(switchTypeRadio1);
        RadioData switchTypeRadio2 = new RadioData("1","自动");
        optionalSwitchTypeList.add(switchTypeRadio2);
        slideBaseAttributeProp.setOptionalSwitchTypeList(optionalSwitchTypeList);

        slideBaseAttributeProp.setTabType("0");

        List<RadioData> optionalTabTypeList = new ArrayList<>(5);
        RadioData tabTypeRadio1 = new RadioData("0","无");
        optionalTabTypeList.add(tabTypeRadio1);
        RadioData tabTypeRadio2 = new RadioData("1","页签");
        optionalTabTypeList.add(tabTypeRadio2);
        RadioData tabTypeRadio3 = new RadioData("2","按钮");
        optionalTabTypeList.add(tabTypeRadio3);
        RadioData tabTypeRadio4 = new RadioData("3","卡片");
        optionalTabTypeList.add(tabTypeRadio4);
        RadioData tabTypeRadio5 = new RadioData("4","自定义右图标");
        optionalTabTypeList.add(tabTypeRadio5);
        slideBaseAttributeProp.setOptionalTabTypeList(optionalTabTypeList);

        slideBaseAttributeProp.setTabLocation("0");

        slideBaseAttributeProp.setButtonLocation("0");

        List<RadioData> optionalTabLocationList = new ArrayList<>(3);
        RadioData tabLocationRadio1 = new RadioData("0", "居左");
        optionalTabLocationList.add(tabLocationRadio1);
        RadioData tabLocationRadio2 = new RadioData("1", "居中");
        optionalTabLocationList.add(tabLocationRadio2);
        RadioData tabLocationRadio3 = new RadioData("2", "居右");
        optionalTabLocationList.add(tabLocationRadio3);
        slideBaseAttributeProp.setOptionalTabLocationList(optionalTabLocationList);

        slideBaseAttributeProp.setButtonHeight("32");

        slideBaseAttributeProp.setSupportFontIcon(true);

        slideBaseAttributeProp.setValue("nvwa-iconfont icon16_KJ_A_NW_arrow-forward");

        slideBaseAttributeProp.setUploadPicTipDesc("图片大小不超过10M，支持jpg、png、gif格式");

        slideBaseAttributeProp.setAnimationType("0");

        List<RadioData> animationTypeList = new ArrayList<>(2);
        RadioData animationTypeRadio1 = new RadioData("0","水平滑动");
        animationTypeList.add(animationTypeRadio1);
        RadioData animationTypeRadio2 = new RadioData("1","垂直滑动");
        animationTypeList.add(animationTypeRadio2);
        slideBaseAttributeProp.setAnimationTypeList(animationTypeList);

        slideBaseAttributeProp.setTimeIntervalValue(5);

        slideBaseAttributeProp.setId("topic_nav_slide_base_attribute");
        topicNavPropertyGroup.addChild(slideBaseAttributeProp);


        BackgroundComboItem sildeBackgroundProp = new BackgroundComboItem("【自定义】背景组件");

        sildeBackgroundProp.setBackgroundType("0");

        List<RadioData> optionalBackgroundTypeList = new ArrayList<>();
        RadioData optionalBackgroundType1 = new RadioData("0", "颜色");
        RadioData optionalBackgroundType2 = new RadioData("1", "图片");
        optionalBackgroundTypeList.add(optionalBackgroundType1);
        optionalBackgroundTypeList.add(optionalBackgroundType2);
        sildeBackgroundProp.setOptionalBackgroundTypeList(optionalBackgroundTypeList);

        sildeBackgroundProp.setColorValue("#fafafa");

        sildeBackgroundProp.setSupportFontIcon(false);

        sildeBackgroundProp.setUploadPicTipDesc("图片大小不超过10M，支持jpg、png、gif格式\n");

        sildeBackgroundProp.setShowType("0");

        List<RadioData> optionalShowTypeList = new ArrayList<>();
        RadioData optionalShowType1 = new RadioData("0", "默认");
        RadioData optionalShowType2 = new RadioData("1", "居中");
        RadioData optionalShowType3 = new RadioData("2", "拉伸");
        RadioData optionalShowType4 = new RadioData("3", "平铺");
        optionalShowTypeList.add(optionalShowType1);
        optionalShowTypeList.add(optionalShowType2);
        optionalShowTypeList.add(optionalShowType3);
        optionalShowTypeList.add(optionalShowType4);
        sildeBackgroundProp.setOptionalShowTypeList(optionalShowTypeList);

        sildeBackgroundProp.setTransparence(50);

        sildeBackgroundProp.setId("topic_nav_slide_background");

        topicNavPropertyGroup.addChild(sildeBackgroundProp);

        return topicNavPropertyGroup;
    }
}
